home *** CD-ROM | disk | FTP | other *** search
- #ifdef SOSP91
- /*
- * sospRecord.h --
- *
- * Declarations of macros to insert log records for the sosp paper
- * measurements.
- *
- * Copyright 1990 Regents of the University of California
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies. The University of California
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
- *
- * $Header: /cdrom/src/kernel/Cvsroot/kernel/utils/sospRecord.h.old,v 1.25 91/05/06 14:54:27 kupfer Exp $ SPRITE (Berkeley)
- */
-
- #ifndef _SOSP_RECORD
- #define _SOSP_RECORD
-
-
- #ifdef KERNEL
- #include <traceLog.h>
- #include <fs.h>
-
- extern TraceLog_Header *SOSP91TracePtr;
- #endif
-
- /*
- * Letters to keep track of trace versions.
- * Version 2: January 9
- */
- #define VERSION1 'A'
- #define VERSION2 'B'
- #define VERSION3 'C'
-
- #define VERSIONLETTER VERSION2
-
- /*
- * Definitions for the types of log records. These are the events being
- * traced.
- */
- #define SOSP_INVALID 0
- #define SOSP_OPEN 1
- #define SOSP_DELETE 2
- #define SOSP_CREATE 3
- #define SOSP_MKLINK 4
- #define SOSP_SET_ATTR 5
- #define SOSP_GET_ATTR 6
- #define SOSP_LSEEK 7
- #define SOSP_CLOSE 8
- #define SOSP_MIGRATE 9
- #define SOSP_TRUNCATE 10
- #define SOSP_CONSIST_CHANGE 11
- #define SOSP_READ 12
- #define SOSP_LOOKUP 13
- #define SOSP_CONSIST_ACTION 14
- #define SOSP_PREFIX 15
- #define SOSP_LOOKUP_OP 16
- #define SOSP_DELETE_DESC 17
-
- #define SOSP_NUM_EVENTS 18
-
- #ifdef KERNEL
- /*
- * The following are macros to call for each type of event to trace. All
- * parameters are int's, unless otherwise marked (such as Fs_FileID's).
- */
-
- /*
- * Trace an open command. The parameters are
- *
- * currentHostID: Current client requesting open command
- * homeHostID: HostID of process requesting open before migration
- * fileID The file ID for the file being opened
- * streamID Fs_FileID in the header of stream returned for this open
- * effID: Effective user id doing the open
- * realID: Real user id doing the open
- * mode Mode flags of the open command
- * numNowReading Number of clients with file open for reading after open
- * numNowWriting Number of clients with file open for writing
- * create The create time for the file
- * fileSize Size in bytes of the file
- * modify The modify time for the file.
- * type Whether it's an FS_FILE, FS_DIRECTORY, etc.
- * consist Whether a consistency update was performed due to open
- */
- #define SOSP_ADD_OPEN_TRACE(currentHostID, homeHostID, fileID, streamID, effID, realID, mode, numNowReading, numNowWriting, create, fileSize, modify, type, consist) \
- {\
- unsigned int sospBuffer[21];\
- \
- sospBuffer[0] = SOSP_OPEN;\
- sospBuffer[1] = currentHostID;\
- sospBuffer[2] = homeHostID;\
- *((Fs_FileID *) &(sospBuffer[3])) = fileID;\
- *((Fs_FileID *) &(sospBuffer[7])) = streamID;\
- sospBuffer[11] = effID;\
- sospBuffer[12] = realID;\
- sospBuffer[13] = mode;\
- sospBuffer[14] = numNowReading;\
- sospBuffer[15] = numNowWriting;\
- sospBuffer[16] = create;\
- sospBuffer[17] = fileSize;\
- sospBuffer[18] = modify;\
- sospBuffer[19] = type;\
- sospBuffer[20] = consist;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (20 * sizeof (int)), SOSP_OPEN);\
- }
-
- /*
- * Trace a delete operation. The fields are
- *
- * currentHostID: Current client requesting delete
- * homeHostID: HostID of process requesting delete before migration
- * fileID The file ID for the file being deleted
- * modify The modify time for the file
- * create The create time for the file.
- * fileSize Size in bytes of the file
- */
- #define SOSP_ADD_DELETE_TRACE(currentHostID, homeHostID, fileID, modify, create, fileSize) \
- {\
- unsigned int sospBuffer[10];\
- \
- sospBuffer[0] = SOSP_DELETE;\
- sospBuffer[1] = currentHostID;\
- sospBuffer[2] = homeHostID;\
- *((Fs_FileID *) &(sospBuffer[3])) = fileID;\
- sospBuffer[7] = modify;\
- sospBuffer[8] = create;\
- sospBuffer[9] = fileSize;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (9 * sizeof (int)), SOSP_DELETE);\
- }
-
- /*
- * Trace a create operation. The fields are
- *
- * currentHostID: Current client requesting create command
- * homeHostID: HostID of process requesting create before migration
- * fileID The file ID for the file being created
- */
- #define SOSP_ADD_CREATE_TRACE(currentHostID, homeHostID, fileID)\
- {\
- unsigned int sospBuffer[7];\
- \
- sospBuffer[0] = SOSP_DELETE;\
- sospBuffer[1] = currentHostID;\
- sospBuffer[2] = homeHostID;\
- *((Fs_FileID *) &(sospBuffer[3])) = fileID;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (6 * sizeof (int)), SOSP_DELETE);\
- }
-
- /*
- * Trace a mklink operation. The fields are
- *
- * currentHostID: Current client requesting mklink command
- * homeHostID: HostID of process requesting mklink before migration
- * fileID The file ID for the file being mklink'ed
- */
- #define SOSP_ADD_MKLINK_TRACE(currentHostID, homeHostID, fileID)\
- {\
- unsigned int sospBuffer[28];\
- \
- sospBuffer[0] = SOSP_MKLINK;\
- sospBuffer[1] = currentHostID;\
- sospBuffer[2] = homeHostID;\
- *((Fs_FileID *) &(sospBuffer[3])) = fileID;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (6 * sizeof (int)), SOSP_MKLINK);\
- }
-
-
- /*
- * Trace a set attr operation. The fields are
- *
- * currentHostID: Current client requesting set attr command
- * homeHostID: HostID of process requesting set attr before migration
- * fileID The file ID for the file being set attr'ed
- * userID The user ID of the person making the request
- */
- #define SOSP_ADD_SET_ATTR_TRACE(currentHostID, homeHostID, fileID, userID)\
- {\
- unsigned int sospBuffer[32];\
- \
- sospBuffer[0] = SOSP_SET_ATTR;\
- sospBuffer[1] = currentHostID;\
- sospBuffer[2] = homeHostID;\
- *((Fs_FileID *) &(sospBuffer[3])) = fileID;\
- sospBuffer[7] = userID;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (7 * sizeof (int)), SOSP_SET_ATTR);\
- }
-
-
- /*
- * Trace a get attr operation. The fields are
- *
- * currentHostID: Current client requesting get attr command
- * homeHostID: HostID of process requesting get attr before migration
- * fileID The file ID for the file being get attr'ed
- * userID The user ID of the person making the request
- */
- #define SOSP_ADD_GET_ATTR_TRACE(currentHostID, homeHostID, fileID, userID)\
- {\
- unsigned int sospBuffer[32];\
- \
- sospBuffer[0] = SOSP_GET_ATTR;\
- sospBuffer[1] = currentHostID;\
- sospBuffer[2] = homeHostID;\
- *((Fs_FileID *) &(sospBuffer[3])) = fileID;\
- sospBuffer[7] = userID;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (7 * sizeof (int)), SOSP_GET_ATTR);\
- }
-
- /*
- * Trace an lseek operation. The fields are
- *
- * streamID Fs_FileID in the header of stream for this operation
- * oldOffset Offset of stream before lseek
- * newOffset Offset of stream after lseek
- * flags The RW flags from the streamPtr->hdr.flags.
- */
- #define SOSP_ADD_LSEEK_TRACE(streamID, oldOffset, newOffset, flags)\
- {\
- unsigned int sospBuffer[8];\
- \
- sospBuffer[0] = SOSP_LSEEK;\
- *((Fs_FileID *) &(sospBuffer[1])) = streamID;\
- sospBuffer[5] = oldOffset;\
- sospBuffer[6] = newOffset;\
- sospBuffer[7] = flags;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (7 * sizeof (int)),SOSP_LSEEK);\
- }
-
- /*
- * Trace a close operation. The fields are
- *
- * streamID Fs_FileID in the header of stream for this operation
- * currentOffset Offset of stream
- * fileSize Size of file being closed
- * flags Stream flags.
- * rwflags The RW flags from the streamPtr->hdr.flags.
- * refCount Number of references to stream. Only valid if
- * FS_RMT_SHARED is set in the flags.
- * consist Whether a consistency update was done due to close
- */
- #define SOSP_ADD_CLOSE_TRACE(streamID, currentOffset, fileSize, flags, rwflags, refCount, consist) \
- {\
- unsigned int sospBuffer[11];\
- \
- sospBuffer[0] = SOSP_CLOSE;\
- *((Fs_FileID *) &(sospBuffer[1])) = streamID;\
- sospBuffer[5] = currentOffset;\
- sospBuffer[6] = fileSize;\
- sospBuffer[7] = flags;\
- sospBuffer[8] = rwflags;\
- sospBuffer[9] = refCount;\
- sospBuffer[10] = consist;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (10 * sizeof (int)),SOSP_CLOSE);\
- }
-
- /*
- * Trace a migrate operation. The fields are
- *
- * fromHostID: Current client requesting migrate command
- * toHostID: HostID of machine to which to migrate
- * streamID Fs_FileID in the header of stream for this operation
- * currentOffset Offset of stream
- */
- #define SOSP_ADD_MIGRATE_TRACE(fromHostID, toHostID, streamID, currentOffset)\
- {\
- unsigned int sospBuffer[8];\
- \
- sospBuffer[0] = SOSP_MIGRATE;\
- sospBuffer[1] = fromHostID;\
- sospBuffer[2] = toHostID;\
- *((Fs_FileID *) &(sospBuffer[3])) = streamID;\
- sospBuffer[7] = currentOffset;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (7 * sizeof (int)),SOSP_MIGRATE);\
- }
-
- /*
- * Trace a truncate operation. The fields are
- *
- * streamID Fs_FileID in the header of stream for this operation
- * oldLength Old length of the file
- * newLength New length of the file
- * modify Modify time of the file before truncation.
- * create Create time of the file before truncation.
- */
- #define SOSP_ADD_TRUNCATE_TRACE(streamID, oldLength, newLength, modify, create) \
- {\
- unsigned int sospBuffer[9];\
- \
- sospBuffer[0] = SOSP_TRUNCATE;\
- *((Fs_FileID *) &(sospBuffer[1])) = streamID;\
- sospBuffer[5] = oldLength;\
- sospBuffer[6] = newLength;\
- sospBuffer[7] = modify;\
- sospBuffer[8] = create;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (8 * sizeof (int)),SOSP_TRUNCATE);\
- }
-
- /*
- * Trace a consistency change operation. This trace is only a result
- * of consistency updates due to a migrate call. The fields are
- *
- * hostID: ID of host causing the consistency change
- * fileID file ID of file causing the fuss
- * operation Is change due to opening or closing the reference?
- * This uses SOSP_OPEN, etc, defines.
- * writeOp Whether the open/etc operation is for writing (TRUE)
- * or reading (FALSE).
- */
- #define SOSP_ADD_CONSIST_CHANGE_TRACE(hostID, fileID, operation, writeOp) \
- {\
- unsigned int sospBuffer[8];\
- \
- sospBuffer[0] = SOSP_CONSIST_CHANGE;\
- sospBuffer[1] = hostID;\
- *((Fs_FileID *) &(sospBuffer[2])) = fileID;\
- sospBuffer[6] = operation;\
- sospBuffer[7] = writeOp;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (7 * sizeof (int)),SOSP_CONSIST_CHANGE);\
- }
-
-
- /*
- * Trace a consistency action operation. The fields are
- *
- * causingHostID: ID of host causing the consistency change
- * affectedHostID: ID of host affected by consistency change
- * fileID fileID of file causing the fuss
- * action Whether the action to take on the client is
- * FSCONSIST_WRITE_BACK_BLOCKS and/or
- * FSCONSIST_INVALIDATE_BLOCKS and/or
- * FSCONSIST_DELETE_FILE, etc.
- * These flags must be &'ed out since other flags may
- * also be set.
- */
- #define SOSP_ADD_CONSIST_ACTION_TRACE(causingHostID, affectedHostID, fileID, action) \
- {\
- unsigned int sospBuffer[8];\
- \
- sospBuffer[0] = SOSP_CONSIST_ACTION;\
- sospBuffer[1] = causingHostID;\
- sospBuffer[2] = affectedHostID;\
- *((Fs_FileID *) &(sospBuffer[3])) = fileID;\
- sospBuffer[7] = action;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (7 * sizeof (int)),SOSP_CONSIST_ACTION);\
- }
-
- /*
- * Trace a read operation on a write-shared file. The fields are
- *
- * hostID: ID of host causing the consistency change
- * fileID ID of file causing the fuss
- * streamID Stream ID of file causing the fuss
- * readIt Whether the request is to read the file (TRUE) or
- * to write the file (FALSE)
- * offset Offset in the file at which to start operation
- * numBytes Number of bytes to read or write
- * numNowReading Number of clients with file open for reading
- * numNowWriting Number of clients with file open for writing
- */
- #define SOSP_ADD_READ_TRACE(hostID, fileID, streamID, readIt, offset, numBytes, numNowReading, numNowWriting)\
- {\
- unsigned int sospBuffer[15];\
- \
- sospBuffer[0] = SOSP_READ;\
- sospBuffer[1] = hostID;\
- *((Fs_FileID *) &(sospBuffer[2])) = fileID;\
- *((Fs_FileID *) &(sospBuffer[6])) = streamID;\
- sospBuffer[10] = readIt;\
- sospBuffer[11] = offset;\
- sospBuffer[12] = numBytes;\
- sospBuffer[13] = numNowReading;\
- sospBuffer[14] = numNowWriting;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (14 * sizeof (int)),SOSP_READ);\
- }
-
- /*
- * Trace a lookup operation. The fields are
- *
- * sospBuffer Our buffer.
- * hostID: ID of host.
- * streamID Resulting stream ID of file.
- * status Status of the lookup.
- * numIDs Number of id's we got.
- * op The operation we're doing.
- * clientID2 Another copy of client ID, for consistency checking.
- * homeHostID Migration client ID.
- * op2 Another copy of the op we're doing.
- * IDs The ids we looked up (The caller stores these.)
- */
- #define SOSP_LOOKUP_OFFSET 10*sizeof(int)
- #define SOSP_ADD_LOOKUP(sospBuffer, hostID, streamID, status, numIDs, homeHostID, op)\
- {\
- \
- sospBuffer[0] = SOSP_LOOKUP;\
- sospBuffer[1] = hostID;\
- sospBuffer[2] = homeHostID;\
- *((Fs_FileID *) &(sospBuffer[3])) = streamID;\
- sospBuffer[7] = status;\
- sospBuffer[8] = numIDs;\
- sospBuffer[9] = op;\
- TraceLog_Insert(SOSP91TracePtr, (Address) sospBuffer,\
- (SOSP_LOOKUP_OFFSET + numIDs*sizeof(Fs_FileID)),SOSP_LOOKUP);\
- }
-
- /*
- * Trace a prefix operation. The fields are
- *
- * sospBuffer Our buffer.
- * clientID ID of host.
- * rpcID Rpc sequence number.
- */
- #define SOSP_ADD_PREFIX_TRACE(clientID, rpcID)\
- {\
- unsigned int sospBuffer[3];\
- \
- sospBuffer[0] = SOSP_PREFIX;\
- sospBuffer[1] = clientID;\
- sospBuffer[2] = rpcID;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (2 * sizeof(int)), SOSP_PREFIX);\
- }
-
- #define SOSP_REMEMBERED_CLIENT (Proc_GetCurrentProc()->rememberedClient)
- #define SOSP_REMEMBERED_MIG (Proc_GetCurrentProc()->rememberedMig)
- #define SOSP_REMEMBERED_OP (Proc_GetCurrentProc()->rememberedOp)
- #define SOSP_IN_NAME_LOOKUP inNameLookup
- #define SOSP_IN_NAME_LOOKUP_FIELD (Proc_GetCurrentProc()->SOSP_IN_NAME_LOOKUP)
-
- /*
- * Trace a lookup operation. Note: this traces the name in
- * Fsprefix_LookupOperation, while SOSP_LOOKUP traces the fileID's in
- * FslclLookup. This trace is used to cross-check the other.
- *
- * The fields are:
- * sospBuffer Our buffer.
- * hostID: ID of host.
- * op The operation we're doing.
- * len Length of the name.
- * IDs The ids we looked up (The caller stores these.)
- */
- #define SOSP_LOOKUP_OP_OFFSET 4*sizeof(int)
- #define SOSP_ADD_LOOKUP_OP(sospBuffer, hostID, op, len)\
- {\
- \
- sospBuffer[0] = SOSP_LOOKUP_OP;\
- sospBuffer[1] = hostID;\
- sospBuffer[2] = op;\
- sospBuffer[3] = len;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- SOSP_LOOKUP_OP_OFFSET -sizeof(int) + len, SOSP_LOOKUP_OP);\
- }
-
- /*
- * Trace a the deletion of a file descriptor.
- *
- * fileID file ID of file being deleted.
- * modify Modify time for the file.
- * create Create time for the file.
- * size Size of the file.
- */
- #define SOSP_ADD_DELETE_DESC_TRACE(fileID, modify, create, size) \
- {\
- unsigned int sospBuffer[8];\
- \
- sospBuffer[0] = SOSP_DELETE_DESC;\
- *((Fs_FileID *) &(sospBuffer[1])) = fileID;\
- sospBuffer[5] = modify;\
- sospBuffer[6] = create;\
- sospBuffer[7] = size;\
- TraceLog_Insert(SOSP91TracePtr, (Address) (sospBuffer+1),\
- (7 * sizeof (int)),SOSP_DELETE_DESC);\
- }
-
-
- #endif /* KERNEL */
- #endif /* _SOSP_RECORD */
- #endif /* SOSP91 */
-